.global main
main:
	li	s0, 101
	li	s1, 1
LB:	# begin
	sltu	t0, s1, s0
	beqz	t0, LE
	mv	a0, s1
	jal	is_prime	# call is_prime

	addi	s1, s1, 1
	j	LB
LE:	# end
	j	LE

is_prime:
	sltiu	t0, a0, 2
	bnez	t0, LN	# 0 and 1 are not prime

	li	t0, 2
L0:
	sltu	t1, t0, a0
	beqz	t1, LY	# a0 is a prime
	remu	t1, a0, t0	# t1 := a0 % t0
	beqz	t1, LN	# a0 % t0 is 0, not prime
	addi	t0, t0, 1
	j	L0
LN:
	li	a0, 0
	jr	ra
LY:
	li	a0, 1
	jr	ra
